/**
 * 
 */
package com.technodo.gamedata;

import org.json.JSONObject;

import com.technodo.enums.ItemStatus;
import com.technodo.utils.GlobalPreferences;
import com.technodo.utils.TechnodoColor;

/**
 * 
 * Director Related information
 * @author Gaurav
 *
 */
public class Director {
	//////////////////////////////////////////////////////////
	// Elements parsed from the json file

	/**
	 * Unique Name of the Director
	 */
	private String name;
	/**
	 * Common Name of the Director (for display in UI)
	 */
	private String title;
	/**
	 * IconPath of this icon
	 */
	private String iconPath;
	/**
	 * Full fledged image of the director
	 */
	private String imagePath;
	/**
	 * Multiplier for the director brand value
	 */
	private int multiplier;
	/**
	 * Divider for the director brand value
	 */
	private int divider;
	/**
	 * Number of players multiplier
	 */
	private String player_multiplier;
	/**
	 * Qualifier for the director 
	 */
	private String qualifier;
	/**
	 * Color of the director
	 */
	private TechnodoColor color;

	//////////////////////////////////////////////////////////////////
	// Elements which are dynamic
	/**
	 * Current Status of the item
	 */
	private ItemStatus status;
	/**
	 * Owner of the Item
	 */
	private PlayerBoard playerBoard;

	/**
	 * 
	 */
	public Director() {
		super();
	}

	public Director(JSONObject jsonDirector) {

		// Parse the Json director and convert to Java data structure
		name    = jsonDirector.optString("name");
		title   = jsonDirector.optString("title");
		iconPath = jsonDirector.optString("icon", GlobalPreferences.defaultTechIcon);
		imagePath = jsonDirector.optString("image", GlobalPreferences.defaultTechIcon);
		multiplier   = jsonDirector.optInt("multiplier");
		divider   = jsonDirector.optInt("divider");
		player_multiplier	= jsonDirector.optString("player_multiplier");
		qualifier  = jsonDirector.optString("qualifier");
		color   = new TechnodoColor(jsonDirector.optString("color"));

		// Initialise non Json variables
		setPlayerBoard(null);
		setStatus(ItemStatus.AVAILABLE);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Director [name=" + name + ", title=" + title + ", iconPath="
				+ iconPath + ", imagePath=" + imagePath + ", multiplier="
				+ multiplier + ", divider=" + divider + ", player_multiplier="
				+ player_multiplier + ", qualifier=" + qualifier + ", color="
				+ color + ", status=" + status
				+ "]";
	}

	/**
	 * @return the multiplier
	 */
	public int getMultiplier() {
		return multiplier;
	}

	/**
	 * @param multiplier the multiplier to set
	 */
	public void setMultiplier(int multiplier) {
		this.multiplier = multiplier;
	}

	/**
	 * @return the divider
	 */
	public int getDivider() {
		return divider;
	}

	/**
	 * @param divider the divider to set
	 */
	public void setDivider(int divider) {
		this.divider = divider;
	}

	/**
	 * @return the player_multiplier
	 */
	public String getPlayer_multiplier() {
		return player_multiplier;
	}

	/**
	 * @param player_multiplier the player_multiplier to set
	 */
	public void setPlayer_multiplier(String player_multiplier) {
		this.player_multiplier = player_multiplier;
	}

	/**
	 * @return the qualifier
	 */
	public String getQualifier() {
		return qualifier;
	}

	/**
	 * @param qualifier the qualifier to set
	 */
	public void setQualifier(String qualifier) {
		this.qualifier = qualifier;
	}

	/**
	 * @return the color
	 */
	public TechnodoColor getColor() {
		return color;
	}

	/**
	 * @param color the color to set
	 */
	public void setColor(TechnodoColor color) {
		this.color = color;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}


	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}


	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the iconPath
	 */
	public String getIconPath() {
		return iconPath;
	}


	/**
	 * @param iconPath the iconPath to set
	 */
	public void setIconPath(String iconPath) {
		this.iconPath = iconPath;
	}


	/**
	 * @return the imagePath
	 */
	public String getImagePath() {
		return imagePath;
	}


	/**
	 * @param imagePath the imagePath to set
	 */
	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}


	/**
	 * @return the status
	 */
	public ItemStatus getStatus() {
		return status;
	}


	/**
	 * @param status the status to set
	 */
	public void setStatus(ItemStatus status) {
		this.status = status;
	}


	/**
	 * @return the playerBoard
	 */
	public PlayerBoard getPlayerBoard() {
		return playerBoard;
	}


	/**
	 * @param playerBoard the playerBoard to set
	 */
	public void setPlayerBoard(PlayerBoard playerBoard) {
		this.playerBoard = playerBoard;
	}	

}
